package com.ifp.opengate.boot.config;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 项目名：ifp-gateway <br>
 * 包名：com.ifp.opengate.boot.config <br>
 * 类名：MybatisConfig <br>
 * 描述： MapperScannerConfigurer 这里由于 processPropertyPlaceHolders 为 true 导致进入 processPropertyPlaceHolders 方法，该方法调用了
 * applicationContext.getBeansOfType(PropertyResourceConfigurer.class); 方法 最后导致在
 * DefaultListableBeanFactory#doGetBeanNamesForType 遍历了所有的 BeanDefinition 导致提前初始化
 * 
 * @author liulx
 * @create 2021-09-07 21:59
 */
@Component
public class MybatisConfig {

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer configurer = new MapperScannerConfigurer();
        configurer.setProcessPropertyPlaceHolders(false);
        configurer.setBasePackage("com.ifp.opengate.*");
        return configurer;
    }
}
